# Contributor: Cág <ca6c@bitmessage.ch>
# Maintainer
pkgname=pcsxr
pkgver=1.9.95
pkgrel=4
pkgdesc="Sony PlayStation emulator"
url="https://pcsxr.codeplex.com/"
arch="all !ppc64le"
license="GPL-3.0-or-later"
depends="libtxc_dxtn"
makedepends="autoconf automake libtool intltool gtk+3.0-dev sdl2-dev mesa-dev
	libxv-dev libxtst-dev nasm libxxf86vm-dev libcdio-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/frealgagu/PCSX-Reloaded/archive/$pkgver.tar.gz
	fix-assert-64bit.patch
	fix-undefined-operations.patch
	fix-uncompress2.patch
	fix-musl.patch
	"
builddir="$srcdir/PCSX-Reloaded-$pkgver/pcsxr"

prepare() {
	default_prepare
	mkdir include
	autoreconf -fi
	intltoolize --force
}

build() {
	export CFLAGS="$CFLAGS -O2 -fcommon"
	./configure \
		--prefix=/usr \
		--enable-opengl \
		--enable-libcdio
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="950f5776f1cf11d31c44cb5f47ab2480a4302ee01af5fa6a3bac0a96936ac280649c9456d78ddf75c038a43977114a780b259467cee5da7f84b8802ca1ec86a1  pcsxr-1.9.95.tar.gz
ddd349a5e7ad5fea809596ccf44e4963992a4a9f96316db4d3c8211bc9d22ef3830115cd7b3b09d1c4c05e6419d21b2e81695d876352ea00128728709f66d58e  fix-assert-64bit.patch
1918231c3411eb2cedc3d3766d48bd766ee7aaaae34b964aec791f1e50851c7b367eb823cf0434e26e7ea8928becb30f7fcc88d27bf990072e9f651637d1f44e  fix-undefined-operations.patch
62593bc0c9422b025fdbcf04bbeff49fa195c8807cc44bc74555ad4d970e07054427299aed65bed0f75487c98e3a68ae78be86eb77822b1cf54ba26ba0e3e5ba  fix-uncompress2.patch
af69e67b12d3398248dab36f79552bff59a8246ea4aecd66f8e0621b7a1c3f5c5f03a16dc9f91b6b520290b5f688cbf7a3d9f3dbd4819f5f89dd1a5c20ccfb78  fix-musl.patch"
